/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2024-03-12 10:02:58
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-03-23 14:49:25
 * @FilePath: /yt-devops/lib/pages/devices/charge_terminal/charge_termimal_list/charge_termimal_list_model.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:json_annotation/json_annotation.dart';
import 'package:yt_devops/utils/enums.dart';

class ChargeTerminalModel {
  ///告警状态
  DeviceAlarmStatus alarmStatus;

  ///设备名称
  String deviceName;

  ///设备类型， 1-单枪 2-双枪 3-无枪，充电主机
  int? deviceType;

  ///设备id
  int id;

  ///是否关联主机，0-是，1-否
  int? isBindMainServer;

  ///产品类型名称
  String productName;

  ///产品类型编号
  int? productType;

  ///
  String productTypeName;

  ///设备序列号
  String sn;

  /// 在线状态
  ConnectStatusType status;

  /// 站点名称
  String siteName;

  ChargeTerminalModel({
    required this.alarmStatus,
    required this.deviceName,
    this.deviceType,
    required this.id,
    required this.status,
    this.isBindMainServer,
    required this.productName,
    required this.productType,
    required this.productTypeName,
    required this.sn,
    required this.siteName,
  });

  factory ChargeTerminalModel.fromJson(Map<String, dynamic> json) =>
      ChargeTerminalModel(
        alarmStatus: $enumDecodeNullable(
                $DeviceAlarmStatusTypeEnumMap, json['alarmStatus']) ??
            DeviceAlarmStatus.normal,
        deviceName: json['deviceName'] ?? '',
        deviceType: json['deviceType'],
        id: json['id'],
        isBindMainServer: json['isBindMainServer'],
        productName: json['productName'] ?? '',
        productType: json['productType'],
        productTypeName: json['productTypeName'] ?? '',
        sn: json['sn'] ?? '',
        siteName: json['siteName'] ?? '',
        status: $enumDecodeNullable($ConnectStatusTypeEnumMap, json['status'],
            unknownValue: ConnectStatusType.unConfig)!,
      );
}
